﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using UIKit;

namespace UIKit.TestHarness
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : UserControl
    {
        public Window1()
        {
            InitializeComponent();
            // LG: Once enough has been coded, this will run!
            this.Loaded += new RoutedEventHandler(Window1_Loaded);            
        }

        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            initWithNavigationController();
        }

        /// <summary>
        /// Using navigation controllers 
        /// http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/UsingNavigationControllers/UsingNavigationControllers.html
        /// </summary>
        private void initWithNavigationController(){
           
            // initialize the navigation controller with our groups page
            UINavigationController navigationController = new UINavigationController();
            //navigationController.initWithRootViewController(groupsController);
            
           
            // The navigation bar and your views are not visible until the window appears on the screen.
            // UIWindow window = new UIWindow();
            
            // cheeky method to make this whole WPF window the UIWindow for other views.
            UIWindow window = UIWindow.createWindow(this);
            // window.initWithFrame(new Rect()); //wanted a CGRect (i.e. mainscreen.bounds), this has been replaced with Rect
            //add the navigation controller to the Window (well, it's view :o) lets keep to MVC)
            window.addSubview(navigationController.view);
            window.makeKeyAndVisible();

            
        }
    }


}
